/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.com.pps.web.common.component.table;

/**
 *
 * @author DaiMX
 */
public class StringColumnComparator extends AbstractColumnComparator {

    protected StringColumnComparator(String pm_attributeName, boolean pm_isAscending) {
        super(pm_attributeName, pm_isAscending);
    }

    public int compareValue(Object pm_valueSource, Object pm_valueTarget) {
        String valueSource = (pm_valueSource != null) ? pm_valueSource.toString() : "";
        String valueTarget = (pm_valueTarget != null) ? pm_valueTarget.toString() : "";

        return (this.m_isAscending) ? valueSource.compareTo(valueTarget) : valueTarget.compareTo(valueSource);
    }
}
